package com.gurumades.jsonform.shared.dispatch;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import net.customware.gwt.dispatch.shared.Result;

import com.gurumades.jsonform.client.presenter.FormItemError;

public class SubmitFormResult implements Result{
	protected String formID;
	protected boolean success;
	
	protected HashMap<String, Serializable> context = new HashMap<String, Serializable>();
	
	/*
	 * @gwt.typeArgs <com.gurumades.jsonform.client.presenter.FormItemError> 
	 */
	protected ArrayList<FormItemError> errors = new ArrayList<FormItemError>();
	
	SubmitFormResult() {
	}

	public SubmitFormResult(String formID, Boolean success) {
		super();
		this.formID = formID;
		this.success = success;
	}
	
	public String getFormID() {
		return formID;
	}
	
	public boolean isSuccess() {
		return success;
	}
	
	public List<FormItemError> getErrors() {
		return new ArrayList<FormItemError>(errors);
	}
	
	public void setErrors(ArrayList<FormItemError> collection) {
		this.errors = collection;
	}
	
	public HashMap<String, Serializable> getContext() {
		return context;
	}
	
	public void setContext(HashMap<String, Serializable> context) {
		this.context = context;
	}
	
}
